/*
 * Bean Validation API
 *
 * License: Apache License, Version 2.0
 * See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.
 */
package com.usefullc.system.validator;

import com.usefullc.common.enums.ValidActionEnum;
import com.usefullc.common.enums.ValidTypeEnum;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * The string has to be a well-formed email address. Exact semantics of what makes up a valid
 * email address are left to Bean Validation providers. Accepts {@code CharSequence}.
 *
 * @author Emmanuel Bernard
 * @author Hardy Ferentschik
 *
 * @since 2.0
 */
@Documented
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
@Retention(RUNTIME)
public @interface UsefulPropertyVerify {

	String message() default "请求参数不合法";


	/**
	 * @return an additional regular expression the annotated element must match. The default
	 * is any string ('.*')
	 */
	String regexp() default "";


	/**
	 * 特殊类型，并集
	 * @return
	 */
	ValidTypeEnum type() default ValidTypeEnum.EMPTY;


	/**
	 * 校验动作，条件
	 * @return
	 */
	ValidActionEnum action() default ValidActionEnum.EMPTY;

	/**
	 * 长度校验，非空必须
	 * @return
	 */
	int maxLen() default Integer.MAX_VALUE;

	/**
	 * 长度校验，非空必须
	 * @return
	 */
	int minLen() default 1;

	/**
	 * 针对整数
	 * @return
	 */
	long max() default Integer.MAX_VALUE;

	/**
	 * 针对整数
	 * @return
	 */
	long min() default 0;

	/**
	 * 精确(针对小数)
	 * @exmpale 1.23
	 * @return 3
	 */
	int precision() default 3;

	/**
	 * 刻度（针对小数）
	 * example 1.23
	 * @return 2
	 */
	int scale() default 2;

	/**
	 * 是否必填
	 * @return
	 */
	boolean required() default false;

	/**
	 * 时间格式化，针对 java.util.Date
	 * @return
	 */
	String dateFormat() default "";

	/**
	 * 条件，js 表达式，当条件成立时，才会执行校验 todo
	 * @return
	 */
	String condition() default "";

}
